package nongchang.kuaijiecaifu.com.ncapp_android.ui.fragment.orderfragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.fragment.BaseFragment;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.data.HomeCartManager;
import nongchang.kuaijiecaifu.com.ncapp_android.retrofit.good.AllCart;
import nongchang.kuaijiecaifu.com.ncapp_android.ui.adapter.OrderExpandAdapter;

/**
 * Created by Administrator on 2016/3/11 0011.
 */
public class AllFragment extends BaseFragment {
    @BindView(R.id.expand_listview)
    ExpandableListView expandableListView;
    private List<AllCart> list;
    private OrderExpandAdapter adapter;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_all_order, container, false);
        return view;
    }
    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ButterKnife.bind(this, getView());
        list=new ArrayList<>();

        for(int i = 0, size = HomeCartManager.cartList.size(); i<size; i++){
            if(HomeCartManager.cartList.get(i).isSelect){
                list.add(HomeCartManager.cartList.get(i));
            }
        }
        adapter=new OrderExpandAdapter(list,getContext());
        expandableListView.setAdapter(adapter);
        expandableListView.setGroupIndicator(null);
    }
}
